@echo off
title Running MSSQL Manager - Dev Mode
echo Starting the application...

:: 检查Node.js是否安装
node --version >nul 2>&1
if %errorlevel% neq 0 (
    echo Error: Node.js is not installed or not in PATH
    echo Please install Node.js from https://nodejs.org/
    pause
    exit /b 1
)

:: 检查是否已安装依赖
if not exist "node_modules" (
    echo Installing dependencies...
    npm install
    if %errorlevel% neq 0 (
        echo Error: Failed to install dependencies
        pause
        exit /b 1
    )
)

:: 启动应用程序
echo.
echo Starting MSSQL Manager...
echo Open your browser and navigate to: http://localhost:3000
echo.
echo Press Ctrl+C to stop the server
echo.

node server.js

echo.
pause